let uid = 0

class Watcher {
  constructor (vm, node, name, type) {
    Dep.target = this
    this. id = ++uid
    this.fieldName = name
    this.node = node
    this.vm = vm
    this.type = type
    this.value = ''
    this.update()
    Dep.target = void 0
  }
  update () {
    this.getField()
    if (!window.batcher) window.batcher = new Batcher()
    batcher.push(this)
  }
  cb () {
    this.node[this.type] = this.value
  }
  getField () {
    this.value = this.vm[this.fieldName]
  }
}